#pragma once
////////////////////////////////////////////////////////////////////////////
// Name: protocol.h
// Author: B. Gian James <gian@BattleDroids.net>
// Description: Protocol definitions
//
// $Id$
////////////////////////////////////////////////////////////////////////////

class Protocol;
class PPkt
{
friend class Protocol;
public:
	PPkt() { cmd = 0; sz = 0; data = NULL; chksum = 0; }
	PPkt(uint8 c) { cmd = c; sz = 0; data = NULL; chksum = 0; }
	PPkt(const PPkt &);
	~PPkt() { if (data) delete [] data; }

	//operator const uchar * () const;
	
//private:
	uint8		cmd;	// commmand
	uint8		sz;		// how many bytes of data
	uchar *		data;
	uint8		chksum;	// cmd + sz

};

class Protocol
{
public:
	static PPkt 	CreatePkt(const uint8 c, uint8 sz, const uchar * d);
	static uint8	chksum(const PPkt & p) { return (p.cmd + p.sz); }
	
private:

};
	